from fastapi import FastAPI
import uvicorn
from pydantic import BaseModel
from server.inference import qwen2_5_7b_inference

app = FastAPI()

class Item(BaseModel):
    info: str
    prompt: str

# qwen_7b 推理路由
@app.on_event("startup")
@app.get("/qwen_7b_init_vllm")
def create_item():
    ret =  qwen2_5_7b_inference.qwen_7b_init_vllm()
    return {"message": f"{ret}"}

# 聊天
@app.post("/task/chat_qwen_7b")
def chat(item: Item):
    ret = qwen2_5_7b_inference.qwen_7B_inference(item.info, item.prompt)
    return ret
